add_gdal_driver(TARGET gdal_DODS SOURCES libdap_headers.h dodsdataset2.cpp PLUGIN_CAPABLE)
gdal_standard_includes(gdal_DODS)
target_include_directories(gdal_DODS PRIVATE ${DAP_INCLUDE_DIRS})
gdal_target_link_libraries(gdal_DODS PRIVATE DAP::DAP DAP::CLIENT)
gdal_target_link_libraries(gdal_DODS PRIVATE LibXml2::LibXml2)

if (DAP_VERSION VERSION_GREATER_EQUAL 3.10)
  target_compile_definitions(gdal_DODS PRIVATE DEFINITIONS -DLIBDAP_310)
endif ()
if (DAP_VERSION VERSION_GREATER_EQUAL 3.9)
  target_compile_definitions(gdal_DODS PRIVATE DEFINITIONS -DLIBDAP_39)
endif ()
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16)
  # These files has CPL_CVSID("$id$") which break ODR and UNITY_BUILD
  set_property(SOURCE dodsdataset2.cpp PROPERTY SKIP_UNITY_BUILD_INCLUSION ON)
endif ()
